

#ifndef PURG_C_INTERFACE_COMPILE
namespace  purg
{
#endif

  template <typename STREAM>
  thread_safety_stream<STREAM>::ts_state::ts_state ()
  {
    pthread_mutex_init ( &mutex , NULL );
  }

  template <typename STREAM>
  thread_safety_stream<STREAM>::ts_state::~ts_state ()
  {
    pthread_mutex_destroy ( &mutex );
  }

  template <typename STREAM>
  void  thread_safety_stream<STREAM>::initialize ( state &s , buffer &b , seed &se , size_t i )
  {
    STREAM::initialize ( s , b , se , i );
  }

  template <typename STREAM>
  void  thread_safety_stream<STREAM>::update_buffer ( state &s , buffer &b )
  {
    STREAM::update_buffer ( s , b );
  }

  template <typename STREAM>
  void  thread_safety_stream<STREAM>::lock ( state &s )
  {
    pthread_mutex_lock ( & ( s.mutex ) );
  }

  template <typename STREAM>
  void  thread_safety_stream<STREAM>::unlock ( state &s )
  {
    pthread_mutex_unlock ( & ( s.mutex ) );
  }
#ifndef PURG_C_INTERFACE_COMPILE
}
#endif
